import router from "./index"
import store from "../store"

// 权限验证
router.beforeEach((to,from,next)=>{
    
  
    if(to.meta.isLogin){
        console.log(to.meta.isLogin);
        // 需要登陆  判断是否登陆
        const token = store.state.token;
        if(token){
            console.log("token已获得，为"+token);
            next()
        }else{
           alert("未登录，或登录状态已失效，请重新登录");
            next({
                path:"/login"
            })
        }
    }else{
        
        next({
           
        })
    }
  
})